home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Developer Connection Student Program
/
ADC Tools Sampler CD Disk 3 1999.iso
/
Cool Demos, SDKs, & Tools
/
Demos⁄Tools⁄Offers
/
Eiffel for CW beta 3
/
EiffelS2
/
LIBRARY
/
MOTEL
/
Events.c
< prev
next >
Wrap
Text File
|
1999-05-28
|
4KB
|
134 lines
/*------------------------------------------------------------------*/
/* Eiffel/S II MacOS Runtime */
/*------------------------------------------------------------------*/
/* Author : Ian Joyner */
/* Release : 1.0 */
/* Date : Dec. 1997 */
/* Copyright : Ian Joyner */
/*------------------------------------------------------------------*/
/********************************************************************/
/* */
/* EVENTs */
/* */
/********************************************************************/
#include <Events.h>
#include <ToolUtils.h>
#include <Eiffel2.h>
BOOLEAN platform_wait_next_event (INTEGER mask, EventRecord *e, INTEGER *code, INTEGER *message, INTEGER *when,
INTEGER *modifiers, INTEGER *x, INTEGER *y, CHARACTER *key_code, CHARACTER *character_code,
INTEGER *os_code, INTEGER *resume_event, INTEGER *convert_scrap,
INTEGER sleep, RgnHandle cursor_region)
{
BOOLEAN b;
b = WaitNextEvent (mask, e, sleep, cursor_region);
*code = e->what;
*message = e->message;
*when = e->when;
*modifiers = e->modifiers;
*x = e->where.h;
*y = e->where.v;
*key_code = (CHARACTER)((e->message >> 8) & 0x00FF);
*character_code = (CHARACTER)(e->message & 0x00FF);
*os_code = (CHARACTER)((e->message >> 24) & 0x00FF);
if ((CHARACTER)((e->message >> 24) & 0x00FF) == suspendResumeMessage)
{
*resume_event = (CHARACTER)(e->message & 0x0001);
*convert_scrap = ((CHARACTER)(e->message & 0x0002) != 0)? 1 : 0;
}
return b;
}
int platform_event_record_size ()
{
EventRecord e;
return (sizeof (e));
}
void platform_system_click (EventRecord *e, WindowPtr w)
{
SystemClick (e, w);
}
INTEGER platform_menu_select (EventRecord *e)
{
return MenuSelect (e->where);
}
INTEGER platform_menu_key (EventRecord *e)
{
return MenuKey ((char)(e->message & charCodeMask));
}
INTEGER platform_find_window (EventRecord *e, WindowPtr *w)
{
/* -- NOTE: I did use the Window records refCon field to
-- store the Eiffel WINDOW reference. However, this
-- did not work when window was associated with the
-- application, like a debug window, but not actually
-- created by the application. */
return FindWindow (e->where, w);
}
BOOLEAN platform_event_active (EventRecord *e)
{
return ((e->modifiers & activeFlag) != 0);
}
BOOLEAN platform_event_button (EventRecord *e)
{
return ((e->modifiers & btnState) != 0);
}
BOOLEAN platform_event_command (EventRecord *e)
{
return ((e->modifiers & cmdKey) != 0);
}
BOOLEAN platform_event_shift (EventRecord *e)
{
return ((e->modifiers & shiftKey) != 0);
}
BOOLEAN platform_event_alpha (EventRecord *e)
{
return ((e->modifiers & alphaLock) != 0);
}
BOOLEAN platform_event_option (EventRecord *e)
{
return ((e->modifiers & optionKey) != 0);
}
BOOLEAN platform_event_control (EventRecord *e)
{
return ((e->modifiers & controlKey) != 0);
}
BOOLEAN platform_event_right_shift_key (EventRecord *e)
{
return ((e->modifiers & rightShiftKey) != 0);
}
BOOLEAN platform_event_right_option_key (EventRecord *e)
{
return ((e->modifiers & rightOptionKey) != 0);
}
BOOLEAN platform_event_right_control_key (EventRecord *e)
{
return ((e->modifiers & rightControlKey) != 0);
}
WindowPtr platform_event_window (INTEGER message)
{
return (WindowPtr) message;
}